package puzzle.projecteuler.p100;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;

public class Problem099 {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		
		URL url = Problem099.class.getResource("Problem099.txt");
		File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));

		int l = 0;
		BigDecimal m = BigDecimal.ZERO;
		int n = 0;
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line = null;
		while ((line = br.readLine()) != null) {
			n ++;
			String[] ns = line.split(",");
			BigDecimal a = BigDecimal.valueOf(Math.log(Integer.valueOf(ns[0])));
			BigDecimal b = new BigDecimal(ns[1]);
			BigDecimal c = b.multiply(a);
			if (c.compareTo(m) == 1) {
				m = c;
				l = n;
			}
		}
		br.close();
		System.out.println(l);
	}
}
